package com.eco.fanliapp.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.AppCompany;
import com.eco.fanliapp.entity.AppGoods;
import com.eco.fanliapp.vo.AppGoodsVo;
import com.eco.fanliapp.vo.TbkItemInfoGetInfo.NTbkItem;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 商品主 服务层
 *
 * @author xiaoxx
 * @date 2019-04-25
 */
public interface IAppGoodsService extends IService<AppGoods> {
    /**
     * 查询商品主信息
     *
     * @param tableId 商品主ID
     * @return 商品主信息
     */
    AppGoods selectAppGoodsById(Long tableId);

    /**
     * 查询商品主列表
     *
     * @param appGoods 商品主信息
     * @return 商品主集合
     */
    List<AppGoods> selectAppGoodsList(AppGoods appGoods);

    /**
     * 新增商品主
     *
     * @param appGoods 商品主信息
     * @return 结果
     */
    int insertAppGoods(AppGoods appGoods);

    /**
     * 修改商品主
     *
     * @param appGoods 商品主信息
     * @return 结果
     */
    int updateAppGoods(AppGoods appGoods);

    /**
     * 删除商品主信息
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    int updateAppGoodsByIds(String ids);

    int deleteAppGoodsByIds(String ids);

    int deleteAppGoodsByItemid(String ids);

    /**
     * 根据商品id查询商品详情
     *
     * @param itemId
     * @return
     */
    AppGoods findAppGoodsByItemId(String itemId);

    /**
     * @param start
     * @param end
     * @return
     */
    List<AppGoods> selectAppGoodsListLIMIT100(Long start, Long end);


    /**
     * @param type
     * @param start
     * @param back
     * @param cid
     * @param sort
     * @return
     */
    List<AppGoods> selectAppGoodsListsINFree(
            Integer type, Integer start, Integer back, Integer cid, Integer sort, Integer companyId);

    /**
     * @return
     */
    List<AppGoods> selectAppGoodsByTaobaoImageIsNull();

    /**
     * @param tableId
     * @return
     */
    int deleteAppGoodsById(Long tableId);

    /**
     * @return
     */
    List<AppGoods> selectAppGoodsListAll();

    /**
     * @param numIid
     * @return
     */
    List<AppGoods> selectAppGoodsByItemId(Long numIid);

    /**
     * 不查免单
     *
     * @param type
     * @param start
     * @param back
     * @param cid
     * @param sort
     * @param companyId
     * @return
     */
    List<AppGoods> selectAppGoodsListsNotFree(Integer type, Integer start, Integer back, Integer cid, Integer recommend,
                                              Integer sort, Integer companyId);

    /**
     * 查询所有免单商品
     *
     * @param type
     * @param cid
     * @param start
     * @param back
     * @param userId
     * @return
     */
    List<AppGoods> selectAppGoodsFreeList(Integer type, Integer cid, Integer start, Integer back,
                                          Long userId, Integer companyId);


    /**
     * 商品添加
     *
     * @param appGoods
     * @return
     */
    ServerResponse addAppGoods(AppGoods appGoods, Integer userId);

    /**
     * 更新商品lucene索引
     *
     * @param appGoods
     */
    void updateLuceneAppGoods(AppGoods appGoods);

    AppGoods selectByOrderId(Long orderId);

    /**
     * 查询商品的优惠劵，折扣价，返佣比例，返佣等信息
     *
     * @param com
     * @param dataBean
     * @return
     */
    AppGoods getMoneyInfoByGoodsId(AppCompany com, AppGoods dataBean);

    /**
     * 查询商品的优惠劵，折扣价，返佣比例，返佣等信息
     *
     * @param com
     * @param dataBean
     * @return
     */
    AppGoods getMoneyInfoByGoodsId(NTbkItem nTbkItem, AppCompany com, AppGoods dataBean);

    String sendSocketData(String url, String message);

    List<AppGoods> selectGoodsList(Integer minId, Integer end, Integer cid);


    /**
     * 更新商品置顶同时添加置顶商品
     *
     * @param map
     * @return
     */
    ServerResponse updateTopAppGoods(Map map);

    List<AppGoods> getUpdateItem(String minId, Integer end, Integer cid);

    /**
     * 对外商品查询
     *
     * @return
     */
    List<AppGoods> findItem(Long userId, Integer end, String updateTime, Integer classifyId);

    /**
     * 对外商品删除
     *
     * @return
     */
    List<AppGoods> selectItem(Long userId, String itemid, Integer classifyId);

    /**
     * 今日爆款
     *
     * @param star
     * @param end
     * @param fqcat
     * @param kType
     * @return
     */
    List<AppGoodsVo> kingKongSonList(Integer star, Integer end, Integer fqcat, Integer kType);

    /**
     * 更新索引
     *
     * @param appGoods
     * @param type
     * @return
     */
    void updateIndex(AppGoods appGoods, String type);

    void deleteIndex(String itemids, String type);

    int updateBatchByItemId(AppGoods appGoods);

    AppGoods selectAppGoodsByIdHitCount(Long itemId);

    Integer updateAppGoodsByIdHitCount(Long tableId, int i);

    void deleteTljGoodsfree();


    void deleteAppGoodsByAddUser(String addUserId, Date time);
}
